﻿using System;

namespace 选择排序
{
	class Program
	{
		static void Main(string[] args)
		{
			int[] a = new int[] { 0,8,7,6,5};
			for(int j = 0; j < a.Length - 1; j++)
			{
				int min_index = j;
				for(int i = j + 1; i < a.Length; i++)
				{
					if (a[i] < a[min_index])
					{
						min_index = i;
					}
				}
				Console.WriteLine("最小下标为：{0}", min_index);
				int t = a[j];
				a[j] = a[min_index];
				a[min_index] = t;
				Console.WriteLine("----------");
				for(int i = 0; i < a.Length; i++)
				{
					Console.WriteLine(a[i]);
				}
			}
		}
	}
}
